package com.s3.demo.service;

import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;

/**
 * @author lzz
 * @create 2021-09-06 14:39
 */
public interface AuthService {


    /**
     * 上传文件
     *
     * @param request 请求
     */
    void doUpload(HttpServletRequest request, String bucketName, String fileName) throws NoSuchAlgorithmException;

    /**
     * 通过预签名url 上传文件
     * @param request
     * @param bucketName
     * @param fileName
     * @param file
     */
    void preSignDoUpload(HttpServletRequest request, String bucketName, String fileName, MultipartFile file) throws NoSuchAlgorithmException, IOException;

    /**
     * 下载文件
     * @param bucketName 桶名称
     * @param fileName s3中的key名字
     * @param request 请求
     * @param response 响应
     */
    void doDownload(String bucketName, String fileName, HttpServletRequest request, HttpServletResponse response) throws NoSuchAlgorithmException;
}
